﻿using System;
using System.IO;
using SEXY;
using UnityEngine;

namespace Character
{
	// Token: 0x0200019C RID: 412
	public class ColorParameter_Alloy : ColorParameter_Base
	{
		// Token: 0x06000AD9 RID: 2777 RVA: 0x0003EA6C File Offset: 0x0003CC6C
		public ColorParameter_Alloy()
		{
		}

		// Token: 0x06000ADA RID: 2778 RVA: 0x0003EA80 File Offset: 0x0003CC80
		public ColorParameter_Alloy(ColorParameter_Alloy copy)
		{
			this.mainColor = copy.mainColor;
			this.metallic = copy.metallic;
			this.smooth = copy.smooth;
		}

		// Token: 0x06000ADB RID: 2779 RVA: 0x0003EAB8 File Offset: 0x0003CCB8
		public override COLOR_TYPE GetColorType()
		{
			return COLOR_TYPE.ALLOY;
		}

		// Token: 0x06000ADC RID: 2780 RVA: 0x0003EABC File Offset: 0x0003CCBC
		public override void Save(BinaryWriter writer)
		{
			base.Save_ColorType(writer);
			base.WriteColor(writer, this.mainColor);
			writer.Write(this.metallic);
			writer.Write(this.smooth);
		}

		// Token: 0x06000ADD RID: 2781 RVA: 0x0003EAEC File Offset: 0x0003CCEC
		public override bool Load(BinaryReader reader, CUSTOM_DATA_VERSION version)
		{
			if (version < CUSTOM_DATA_VERSION.DEBUG_04)
			{
				base.ReadColor(reader, ref this.mainColor);
				return true;
			}
			COLOR_TYPE color_TYPE = ColorParameter_Base.Load_ColorType(reader, version);
			if (color_TYPE == COLOR_TYPE.NONE)
			{
				return false;
			}
			if (color_TYPE != this.GetColorType())
			{
				GlobalData.Debug_LogError("颜色类型不同");
			}
			base.ReadColor(reader, ref this.mainColor);
			this.metallic = reader.ReadSingle();
			this.smooth = reader.ReadSingle();
			return true;
		}

		// Token: 0x06000ADE RID: 2782 RVA: 0x0003EB5C File Offset: 0x0003CD5C
		public void FromSexyData(HSColorSet colorSet)
		{
			this.mainColor = colorSet.rgbaDiffuse;
			this.metallic = colorSet.specularIntensity;
			this.smooth = colorSet.specularSharpness;
		}

		// Token: 0x06000ADF RID: 2783 RVA: 0x0003EB84 File Offset: 0x0003CD84
		public override void SetToMaterial(Material material)
		{
			material.color = this.mainColor;
			material.SetFloat(CustomDataManager._Metal, this.metallic);
			material.SetFloat(CustomDataManager._Roughness, 1f - this.smooth);
		}

		// Token: 0x04000ACF RID: 2767
		public Color mainColor = Color.white;

		// Token: 0x04000AD0 RID: 2768
		public float metallic;

		// Token: 0x04000AD1 RID: 2769
		public float smooth;
	}
}
